
import React, { useState } from 'react';
import TableTransfer from './TableTransfer';

const leftTableColumns = [
  {
    dataIndex: 'conEleId',
    title: '设备编号',
  },
  {
    dataIndex: 'element.eleName',
    title: '元素',
    
  }
];
const rightTableColumns = [
  {
    dataIndex: 'conEleId',
    title: '设备编号',
  },
  {
    dataIndex: 'deviceName',
    title: '设备名称',
    
  }
];


export interface TransferDemoProps {
  tableData: Array<Object>;
  targetIds: Array<Object>;
}
const TransferCondition: React.FC<TransferDemoProps>= (props) => {
 
  const [targetKeys, setTargetKeys] = useState<Array<Object>>(props.targetIds);

  const {tableData} = props;
  const onChange = (nextTargetKeys) => {
    console.log(nextTargetKeys)
    setTargetKeys(nextTargetKeys);
  };


    return (
      <>
        <TableTransfer
          dataSource={tableData}
          targetKeys={targetKeys}
          disabled={false}
          showSearch={true}
          onChange={onChange}
          filterOption={(inputValue, item) =>
            item.title.indexOf(inputValue) !== -1 || item.tag.indexOf(inputValue) !== -1
          }
          titles={["未选条件","已选条件"]}
          leftColumns={leftTableColumns}
          rightColumns={rightTableColumns}
        />
      </>
    );

}
export default TransferCondition;

